Nested p2m: clarify logic in p2m_get_nestedp2m()
authorTim Deegan <Tim.Deegan@citrix.com>
Thu, 30 Jun 2011 09:26:54 +0000 (10:26 +0100)
committerTim Deegan <Tim.Deegan@citrix.com>
Thu, 30 Jun 2011 09:26:54 +0000 (10:26 +0100)
This just makes the behaviour of this function a bit more explicit.  It
may be that it also needs to be changed. :)

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
xen/arch/x86/mm/p2m.c

index 20763b09bb014ae4e5d17b41b2d8feadcbe6ba46..a74dd37e77ab3c76008405c8c49392e484ac66b4 100644 (file)
@@ -1131,11 +1131,9 @@ p2m_get_nestedp2m(struct vcpu *v, uint64_t cr3)
 
     d = v->domain;
     nestedp2m_lock(d);
-    for (i = 0; i < MAX_NESTEDP2M; i++) {
-        p2m = d->arch.nested_p2m[i];
-        if ((p2m->cr3 != cr3 && p2m->cr3 != CR3_EADDR) || (p2m != nv->nv_p2m))
-            continue;
-
+    p2m = nv->nv_p2m;
+    if ( p2m && (p2m->cr3 == cr3 || p2m->cr3 == CR3_EADDR) )
+    {
         nv->nv_flushp2m = 0;
         p2m_getlru_nestedp2m(d, p2m);
         nv->nv_p2m = p2m;